home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Freeware / Gobby 0.4.7 / gobby-0.4.7.exe / {app} / share / gtksourceview-2.0 / language-specs / php.lang < prev    next >
Extensible Markup Language  |  2008-09-09  |  11KB  |  323 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.  Author: Francesco Gigli <jaramir@aruba.it>
  5.  Copyright (C) 2003 Francesco Gigli <jaramir@aruba.it>
  6.  Copyright (C) 2004 David A Knight <david@ritter.demon.co.uk>
  7.  Copyright (C) 2005 Rowan Lewis <rowanjl@gmail.com>
  8.  Copyright (C) 2006 Steve Fr├⌐cinaux <steve@istique.net>
  9.  Copyright (C) 2007 Patryk Zawadzki <patrys@pld-linux.org>
  10.  Copyright (C) 2007 Eric Norige <thelema@swbell.net>
  11.  
  12.  This library is free software; you can redistribute it and/or modify
  13.  it under the terms of the GNU General Public License as published by
  14.  the Free Software Foundation; either version 2 of the License, or
  15.  (at your option) any later version.
  16.  
  17.  This program is distributed in the hope that it will be useful,
  18.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  19.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20.  GNU General Public License for more details.
  21.  
  22.  You should have received a copy of the GNU General Public License
  23.  along with this program; if not, write to the Free Software
  24.  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  25.  
  26. -->
  27. <language id="php" _name="PHP" version="2.0" _section="Scripts">
  28.   <metadata>
  29.     <property name="mimetypes">text/x-php;application/x-php;text/x-php-source;application/x-php-source</property>
  30.     <property name="globs">*.php;*.php3;*.php4;*.phtml</property>
  31.     <property name="line-comment-start">#</property>
  32.     <property name="block-comment-start">/*</property>
  33.     <property name="block-comment-end">*/</property>
  34.   </metadata>
  35.  
  36.   <styles>
  37.     <style id="comment" _name="Comment" map-to="def:comment"/>
  38.     <style id="error" _name="Error" map-to="def:error"/>
  39.     <style id="variable" _name="Variable" map-to="def:identifier"/>
  40.     <style id="escape" _name="Escaped Character" map-to="def:special-char"/>
  41.     <style id="string" _name="String" map-to="def:string"/>
  42.     <style id="here-doc" _name="Heredoc" map-to="def:string"/>
  43.     <style id="here-doc-bound" _name="Heredoc Bound" map-to="def:keyword"/>
  44.     <style id="keyword" _name="Keyword" map-to="def:keyword"/>
  45.     <style id="operator" _name="Operator" map-to="def:operator"/>
  46.     <style id="type" _name="Data Type" map-to="def:type"/>
  47.     <style id="null-value" _name="Null Value" map-to="def:special-constant"/>
  48.     <style id="boolean" _name="Boolean value" map-to="def:boolean"/>
  49.     <style id="floating-point" _name="Floating point number" map-to="def:floating-point"/>
  50.     <style id="decimal" _name="Decimal number" map-to="def:decimal"/>
  51.     <style id="octal" _name="Octal number" map-to="def:base-n-integer"/>
  52.     <style id="hexadecimal" _name="Hexadecimal number" map-to="def:base-n-integer"/>
  53.   </styles>
  54.  
  55.   <definitions>
  56.  
  57.     <context id="bash-line-comment" style-ref="comment" end-at-line-end="true" extend-parent="false">
  58.       <start>#</start>
  59.       <include>
  60.         <context ref="def:in-line-comment"/>
  61.       </include>
  62.     </context>
  63.  
  64.     <context id="cpp-line-comment" style-ref="comment" end-at-line-end="true" extend-parent="false">
  65.       <start>//</start>
  66.       <include>
  67.         <context ref="def:in-line-comment"/>
  68.       </include>
  69.     </context>
  70.  
  71.     <context id="c-block-comment" style-ref="comment">
  72.       <start>/\*</start>
  73.       <end>\*/</end>
  74.       <include>
  75.         <context ref="def:in-line-comment"/>
  76.       </include>
  77.     </context>
  78.  
  79.     <context id="close-comment-outside-comment" style-ref="error">
  80.       <match>\*/(?!\*)</match>
  81.     </context>
  82.  
  83.     <context id="escape" style-ref="escape">
  84.       <match>\\((\\|"|n|t|\$|r)|[0-7]{1,3}|x[0-9a-fA-F]{1,2})</match>
  85.     </context>
  86.  
  87.     <context id="variable" style-ref="variable">
  88.       <match>[$]+[a-zA-Z_][a-zA-Z0-9_]*</match>
  89.     </context>
  90.  
  91.     <context id="array-operators" style-ref="variable">
  92.       <match>(\[|\])</match>
  93.     </context>
  94.  
  95.     <context id="string-var">
  96.       <include>
  97.         <context ref="variable"/>
  98.         <context id="curly-var" style-ref="variable" >
  99.           <start>{(?=\$)</start>
  100.           <end>}</end>
  101.           <include>
  102.             <context ref="string-var"/>
  103.           </include>
  104.         </context>
  105.         <context id="backwards-curly-var" style-ref="variable">
  106.           <start>\${</start>
  107.           <end>}</end>
  108.           <include>
  109.             <context ref="string-var"/>
  110.           </include>
  111.         </context>
  112.       </include>
  113.     </context>
  114.  
  115.     <context id="double-quoted-string" style-ref="string">
  116.       <start>"</start>
  117.       <end>"</end>
  118.       <include>
  119.         <context ref="escape"/>
  120.         <context ref="string-var"/>
  121.         <context ref="def:line-continue"/>
  122.       </include>
  123.     </context>
  124.  
  125.     <context id="single-quoted-string" style-ref="string">
  126.       <start>'</start>
  127.       <end>'</end>
  128.       <include>
  129.         <context style-ref="def:special-char">
  130.           <match>\\['\\]</match>
  131.         </context>
  132.         <context ref="def:line-continue"/>
  133.       </include>
  134.     </context>
  135.  
  136.     <context id="backtick-string" style-ref="string" extend-parent="false">
  137.       <start>`</start>
  138.       <end>`</end>
  139.       <include>
  140.         <context ref="escape"/>
  141.         <context ref="def:line-continue"/>
  142.       </include>
  143.     </context>
  144.  
  145.     <context id="here-doc-string" style-ref="here-doc" extend-parent="true">
  146.       <start>(<<<)\s?([a-zA-Z_][a-zA-Z0-9_]*)</start>
  147.       <end>^(\%{2@start});?$</end>
  148.       <include>
  149.         <context sub-pattern="0" where="start" style-ref="here-doc-bound"/>
  150.         <context sub-pattern="1" where="end" style-ref="here-doc-bound"/>
  151.         <context ref="escape"/>
  152.         <context ref="string-var"/>
  153.         <context ref="def:line-continue"/>
  154.       </include>
  155.     </context>
  156.  
  157.     <context id="keywords" style-ref="keyword">
  158.       <keyword>abstract</keyword>
  159.       <keyword>and</keyword>
  160.       <keyword>as</keyword>
  161.       <keyword>break</keyword>
  162.       <keyword>case</keyword>
  163.       <keyword>catch</keyword>
  164.       <keyword>class</keyword>
  165.       <keyword>const</keyword>
  166.       <keyword>continue</keyword>
  167.       <keyword>default</keyword>
  168.       <keyword>die</keyword>
  169.       <keyword>do</keyword>
  170.       <keyword>doubleval</keyword>
  171.       <keyword>echo</keyword>
  172.       <keyword>else</keyword>
  173.       <keyword>elseif</keyword>
  174.       <keyword>empty</keyword>
  175.       <keyword>endfor</keyword>
  176.       <keyword>endforeach</keyword>
  177.       <keyword>endswitch</keyword>
  178.       <keyword>endwhile</keyword>
  179.       <keyword>extends</keyword>
  180.       <keyword>final</keyword>
  181.       <keyword>floatval</keyword>
  182.       <keyword>for</keyword>
  183.       <keyword>foreach</keyword>
  184.       <keyword>function</keyword>
  185.       <keyword>gettype</keyword>
  186.       <keyword>global</keyword>
  187.       <keyword>if</keyword>
  188.       <keyword>implements</keyword>
  189.       <keyword>import</keyword>
  190.       <keyword>include</keyword>
  191.       <keyword>include_once</keyword>
  192.       <keyword>instanceof</keyword>
  193.       <keyword>interface</keyword>
  194.       <keyword>intval</keyword>
  195.       <keyword>list</keyword>
  196.       <keyword>namespace</keyword>
  197.       <keyword>new</keyword>
  198.       <keyword>or</keyword>
  199.       <keyword>print</keyword>
  200.       <keyword>print_r</keyword>
  201.       <keyword>private</keyword>
  202.       <keyword>protected</keyword>
  203.       <keyword>public</keyword>
  204.       <keyword>require</keyword>
  205.       <keyword>require_once</keyword>
  206.       <keyword>return</keyword>
  207.       <keyword>serialize</keyword>
  208.       <keyword>settype</keyword>
  209.       <keyword>static</keyword>
  210.       <keyword>strval</keyword>
  211.       <keyword>switch</keyword>
  212.       <keyword>throw</keyword>
  213.       <keyword>try</keyword>
  214.       <keyword>unserialize</keyword>
  215.       <keyword>unset</keyword>
  216.       <keyword>var</keyword>
  217.       <keyword>var_dump</keyword>
  218.       <keyword>var_export</keyword>
  219.       <keyword>while</keyword>
  220.       <keyword>xor</keyword>
  221.     </context>
  222.  
  223.     <context id="operators" style-ref="operator" extend-parent="false">
  224.       <match>[-.~^@,;:/%|\=\+\*\!\?&<>()]</match>
  225.     </context>
  226.  
  227.     <context id="type" style-ref="type">
  228.       <keyword>array</keyword>
  229.       <keyword>bool</keyword>
  230.       <keyword>boolean</keyword>
  231.       <keyword>double</keyword>
  232.       <keyword>float</keyword>
  233.       <keyword>int</keyword>
  234.       <keyword>integer</keyword>
  235.       <keyword>object</keyword>
  236.       <keyword>real</keyword>
  237.       <keyword>string</keyword>
  238.       <keyword>unset</keyword>
  239.     </context>
  240.  
  241.     <context id="null-value" style-ref="null-value">
  242.       <prefix>(?i)\b</prefix> <!-- case insensitive -->
  243.       <keyword>null</keyword>
  244.     </context>
  245.  
  246.     <context id="boolean" style-ref="boolean">
  247.       <prefix>(?i)\b</prefix> <!-- case insensitive -->
  248.       <keyword>false</keyword>
  249.       <keyword>true</keyword>
  250.     </context>
  251.  
  252.     <context id="float" style-ref="floating-point">
  253.       <match extended="true">
  254.         (?<![\w\.])
  255.         ([0-9]+[Ee][+-]?[0-9]+ |
  256.          ([0-9]*\.[0-9]+ | [0-9]+\.[0-9]*)([Ee][+-]?[0-9]+)?)
  257.         (?![\w\.])
  258.       </match>
  259.     </context>
  260.  
  261.     <context id="decimal-number" style-ref="decimal">
  262.       <match extended="true">
  263.         (?<![\w\.])
  264.         [+-]?([1-9][0-9]*|0)
  265.         (?![\w\.])
  266.       </match>
  267.     </context>
  268.  
  269.     <context id="octal-number" style-ref="octal">
  270.       <match extended="true">
  271.         (?<![\w\.])
  272.         [+-]?0[0-7]+
  273.         (?![\w\.])
  274.       </match>
  275.     </context>
  276.  
  277.     <context id="hexadecimal-number" style-ref="hexadecimal">
  278.       <match extended="true">
  279.         (?<![\w\.])
  280.         [+-]?0x[0-9a-fA-F]+
  281.         (?![\w\.])
  282.       </match>
  283.     </context>
  284.  
  285.     <context id="php-block">
  286.       <start><([?](php)?)</start>
  287.       <end>[?]></end>
  288.       <include>
  289.         <context sub-pattern="0" where="start" style-ref="keyword"/>
  290.         <context sub-pattern="0" where="end" style-ref="keyword"/>
  291.         <context ref="cpp-line-comment"/>
  292.         <context ref="bash-line-comment"/>
  293.         <context ref="c-block-comment"/>
  294.         <context ref="double-quoted-string"/>
  295.         <context ref="single-quoted-string"/>
  296.         <context ref="backtick-string"/>
  297.         <context ref="here-doc-string"/>
  298.         <context ref="variable"/>
  299.         <context ref="array-operators"/>
  300.         <context ref="keywords"/>
  301.         <context ref="operators"/>
  302.         <context ref="type"/>
  303.         <context ref="null-value"/>
  304.         <context ref="boolean"/>
  305.         <context ref="float"/>
  306.         <context ref="decimal-number"/>
  307.         <context ref="octal-number"/>
  308.         <context ref="hexadecimal-number"/>
  309.       </include>
  310.     </context>
  311.  
  312.     <replace id="html:embedded-lang-hook" ref="php-block"/>
  313.  
  314.     <context id="php">
  315.       <include>
  316.         <context ref="php-block"/>
  317.         <context ref="html:html"/>
  318.       </include>
  319.     </context>
  320.  
  321.   </definitions>
  322. </language>
  323.